<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
	<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><spring:message code="message.listForm.qiYeChanPinKuGuanLi"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
    
    <style type="text/css">
    @media(max-width:767px){
            .form-group-xs{
            margin-left:0px !important;
            }
        }

	.text-left{
    color:#949494;
    }
    </style>    
    
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

    <section class="content-header">
        <h1><spring:message code="message.lable.proddruginfoSTDmergeSee"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.StdManage"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.proddruginfoStd"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.proddruginfoSeeStd"/></a></li>
        </ol>
    </section>
    
    
    
    <section class="content" style="min-height:inherit;">
     
    <table class="infoBox">
      <tr>
        <td width="150px" class="infoBoxleft">
        <p style="color:#fff;font-size:20px;text-align:center"><spring:message code="message.listForm.qiYeChanPinXinXi"/></p>
        </td>
        <td>
        	<form role="form" class="form-horizontal" action="${ctx }/stdDrug/editInfo.html" method="post">
                <div class="box-body" style="background:url('${ctx }/lib/img/infobg.png') no-repeat bottom right;">
                  <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div class="col-sm-3 text-left" >${detail.qualityspecName}</div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right"><spring:message code="message.listForm.jiXing"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div  class="col-sm-3 text-left">${detail.formName}</div>
                    
                 </div>
 
                <div class="form-group form-group-xs group-info"  style="margin-top:-10px;margin-bottom:-10px;">
                     <label for="inputTextAlter2" class="col-sm-2 text-right"><spring:message code="message.listForm.guiGe"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div class="col-sm-3 text-left" >${detail.specName}</div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right"><spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.yanZheng.maoHao"/></label>
                     <div  class="col-sm-3 text-left">${detail.prodCompName}</div>
                </div> 
                </div>
             </form>
        </td>
      </tr>
      </table>

     </section>
    
     <section class="content-header" style="margin-top:-5px">
       <table class="jqgrid" id="oneGridlist"></table>
       <div id="oneGridpage"></div>   
     </section>
     

    
    <section class="content" style="margin-top:3px">
	   <div class=" box box-success">
         <div class="box-body">
                <div class="input">
                	<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="qualityspecName" name="qualityspecName" type="text" placeholder="<spring:message code="message.listForm.tongYongMing"/>" />
                    	</div>
                	<div class="textalign1"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput"  id="drugcode" name="drugcode" type="text" placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>" />
                    	</div>
                    <div class="textalign1"><spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="prodCompName" name="prodCompName" type="text" placeholder="<spring:message code="message.listForm.shengChanQiYe"/>" />
                   		</div>
                    <div class="textalign1" >
                    <button id="selectDrug" type="button" onclick="gridSerch();" class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                   </div>
               </div>
           </div>
        </div>

        <table class="jqgrid" id="twoGridlist"></table>
        <div id="twoGridpage"></div>
        
        <div class=" box box-warning bottongroup">
             <a href="${ctx}/stdProdDrugInfo/toStdProdDrugInfoList.html" class="btn btn-default btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
        </div>
     </section>
    
        
    <%@ include file="/WEB-INF/component/commonJS.jsp" %> 
    <script type="text/javascript">
    
    //绑定回车
    $('#drugcode,#qualityspecName,#prodCompName').bind('keydown', function(event) {
        if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
            $('#selectDrug').click();
        }
    }); 
  
    $("#qualityspecName").focus();//加载页面光标在第一个查询框内
    
        $(function () {
            $("#oneGridlist").jqGrid({
                url: "${ctx}/stdProdDrugInfo/getMergerProdDrugInfoLog.html",
                mtype: "POST",
                datatype: "json",
                postData: { "prodId" : "${prodId}" },
                autowidth: true,
                shrinkToFit:false,
                height: 50,
                colNames: [ 
                            'prodId',
                            'qualityspecId',
                            '<spring:message code="message.listForm.yaoPinBianMa"/>', 
                            '<spring:message code="message.listForm.tongYongMing"/>', 
                            '<spring:message code="message.listForm.jiXing"/>', 
                            '<spring:message code="message.listForm.guiGe"/>', 
                            '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
                            '<spring:message code="message.listForm.danWei"/>',
                            '<spring:message code="message.listForm.caiZhi"/>',
                            '<spring:message code="message.listForm.shengChanQiYe"/>',
                            '<spring:message code="message.lable.status"/>',
                            '<spring:message code="message.listForm.heBingShiJian"/>', 
                            '<spring:message code="message.listForm.heBingRen"/>'
                            ],
                colModel: [
                    { name: 'prodId', width: 120 ,hidden:true, align:"center",sortable: false},
                    { name: 'qualityspecId',hidden:true, width: 120 , align:"center",sortable: false},
                    { name: 'drugCode', width: 160 , align:"center",sortable: false,
                        formatter:function(cellvalue, options, row){
                            return '<a href="javascript:showDrugInfo(\''+ row.prodId +'\');">'+cellvalue+'</a>';
                        } 
                    },
                    { name: 'qualityspecName', width: 200 , align:"left" ,sortable: false},
                    { name: 'formName', width: 80 , align:"center" ,sortable: false},
                    { name: 'specName', width: 80 , align:"left" ,sortable: false},
                    { name: 'factor', width: 80 , align:"center" ,sortable: false},
                    { name: 'unitName', width: 80 , align:"center" ,sortable: false},
                    { name: 'materialName', width: 80 , align:"center" ,sortable: false},
                    { name: 'prodCompName', width: 200 , align:"left",sortable: false,
                        formatter:function(cellvalue, options, row){
                            return '<a href="javascript:showCompInfo(\''+ row.prodCompId +'\');">'+cellvalue+'</a>';
                        }
                    },
                    { name: 'status', width: 80 , align:"center",sortable: false,
                        cellattr:function (rowId, val, rawObject, cm) {
                	    	if(val == '停用'){
                	    		return 'style="color:red"';
                	    	}
                        },
                        formatter:function(cellvalue, options, row){
                            if (cellvalue == 1) {
                                return "<spring:message code="message.listForm.QiYong"/>";
                            } else if (cellvalue == 3) {
                                return "<spring:message code="message.button.combine"/>";
                            }
                            return "<spring:message code="message.listForm.TingYong"/>";
                        }
                    },
                    { name: 'updDatetime', width: 160 , align:"center" ,sortable: false},
                    { name: 'updUser', width: 160 , align:"left" ,sortable: false}
                ],
                rowNum: 1,
                rownumbers: true,
                viewrecords: true,
                caption: "<spring:message code="message.list.proddruginfoStdlistMerge"/>",
                jsonReader: {
                    repeatitems: false,
                    id: "prodId"
                }
            });
            $("#oneGridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            
            
            $("#twoGridlist").jqGrid({
                url: "${ctx}/stdProdDrugInfo/getMergedProdDrugInfoLogList.html",
                mtype: "POST",
                datatype: "json",
                postData: { "prodId" : "${prodId}" },
                autowidth: true,
                shrinkToFit:false,
                height: 270,
                colNames: [ 
                            'prodId',
                            'qualityspecId',
                            '<spring:message code="message.listForm.yaoPinBianMa"/>', 
                            '<spring:message code="message.listForm.tongYongMing"/>', 
                            '<spring:message code="message.listForm.jiXing"/>', 
                            '<spring:message code="message.listForm.guiGe"/>', 
                            '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
                            '<spring:message code="message.listForm.danWei"/>',
                            '<spring:message code="message.listForm.caiZhi"/>',
                            '<spring:message code="message.listForm.shengChanQiYe"/>',
                            '<spring:message code="message.lable.status"/>',
                            '<spring:message code="message.listForm.heBingShiJian"/>', 
                            '<spring:message code="message.listForm.heBingRen"/>'
                            ],
                colModel: [
                    { name: 'prodId', width: 120 ,hidden:true, align:"center",sortable: false},
                    { name: 'qualityspecId',hidden:true, width: 120 , align:"center",sortable: false},
                    { name: 'drugCode', width: 160 , align:"center",sortable: false,
                        formatter:function(cellvalue, options, row){
                            return '<a href="javascript:showDrugInfo(\''+ row.prodId +'\');">'+cellvalue+'</a>';
                        } 
                    },
                    { name: 'qualityspecName', width: 200 , align:"left" ,sortable: false},
                    { name: 'formName', width: 80 , align:"center" ,sortable: false},
                    { name: 'specName', width: 80 , align:"left" ,sortable: false},
                    { name: 'factor', width: 80 , align:"center" ,sortable: false},
                    { name: 'unitName', width: 80 , align:"center" ,sortable: false},
                    { name: 'materialName', width: 80 , align:"center" ,sortable: false},
                    { name: 'prodCompName', width: 200 , align:"left",sortable: false,
                        formatter:function(cellvalue, options, row){
                            return '<a href="javascript:showCompInfo(\''+ row.prodCompId +'\');">'+cellvalue+'</a>';
                        }
                    },
                    { name: 'status', width: 80 , align:"center",sortable: false,
                    	cellattr:function (rowId, val, rawObject, cm) {
                	    	if(val == '停用'){
                	    		return 'style="color:red"';
                	    	}
                        },
                        formatter:function(cellvalue, options, row){
                            if (cellvalue == 1) {
                                return "<spring:message code="message.listForm.QiYong"/>";
                            } else if (cellvalue == 3) {
                                return "<spring:message code="message.button.combine"/>";
                            }
                            return "<spring:message code="message.listForm.TingYong"/>";
                        }
                    },
                    { name: 'updDatetime', width: 160 , align:"center" ,sortable: false},
                    { name: 'updUser', width: 160 , align:"left" ,sortable: false}
                ],
                rowNum: 20,
                rowList: [10,20,50,100],
                rownumbers: true,
                pager: "#twoGridpage",
                viewrecords: true,
                caption: "<spring:message code="message.list.proddruginfoStdlistMerged"/>",
                jsonReader: {
                    repeatitems: false,
                    id: "prodId"
                }
            });
            $("#twoGridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            
            
            $(window).trigger("resize");  
            
        });
        

        //查询
        function gridSerch() {
            var drugcode = $("#drugcode").val();
            var qualityspecName = $("#qualityspecName").val();
            var prodCompName = $("#prodCompName").val();
            $("#twoGridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"drugCode":drugcode,
                        "qualityspecName":qualityspecName,
                        "prodCompName":prodCompName}
            }).trigger("reloadGrid"); //重新载入  
        }
        
        
      //药品弹窗
         function showDrugInfo(prodId) {
            $.HN.dialog.open({
                "id": "showDrugInfo", 
                "title": "<spring:message code="message.listForm.chanPinXiangQing"/>", 
                "url": "${ctx}/stdProdDrugInfo/toStdProdDrugInfoDetailTC.html?prodId="+prodId,
                "data": {}, 
                "width": 800, 
                "height": 400, 
                "closefunc":function() {
                    
                }
            });
        } 
        
        
        //生产企业弹窗
        function showCompInfo(prodCompId) {
            $.HN.dialog.open({
                "id": "showCompInfo", 
                "title": "<spring:message code="message.listForm.ShengChanQiYeXinXi"/>", 
                "url": "${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+prodCompId,
                "data": {}, 
                "width": 800, 
                "height": 400, 
                "closefunc":function() {
                    
                }
            });
        }
     
 
    </script>
</body>
</html>